package com.bb.flow.service.imp.node.UserLoginFlow;

import com.bb.flow.api.ConditionValueCalc;
import com.bb.flow.api.ExpressionCalc;
import com.bb.flow.api.entries.ConditionResult;
import com.bb.flow.api.entries.FlowContext;
import com.bb.flow.config.enumtype.DataType;

public class JudgeValidateCode implements ConditionValueCalc, ExpressionCalc {

    private int code;

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    /**
     * 结果条件条件判断
     *
     * @param flowNodeData  流程上下文参数
     * @return true:传入的条件成功,false:条件不成立
     */
    @Override
    public ConditionResult calcExpress(FlowContext flowNodeData) {
        ConditionResult result = new ConditionResult();
        result.setResult(true);
        result.setDataType(DataType.BOOLEAN);
        return result;
    }

    /**
     * 计算表达式
     *
     * @param expression              表达式
     * @param flowNodeData            当前流程上下文信息
     * @return true 满足条件,false 不满足条件
     */
    @Override
    public boolean calc(String expression, FlowContext flowNodeData,
                        ConditionResult result) {
        return true;
    }
}
